home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_108 / bash-108.zoo / bash-1.08 / examples / func < prev    next >
Encoding:
Text File  |  1991-02-26  |  442 b   |  28 lines

  1. #
  2. # func -- print out definitions for functions named by arguments
  3. #
  4. # usage: func name [name ...]
  5. #
  6. # Chet Ramey
  7. # chet@ins.CWRU.Edu
  8. func()
  9. {
  10.     local status=0
  11.  
  12.     if [ $# -eq 0 ] ; then
  13.         echo "usage: func name [name...]" 1>&2
  14.         return 1
  15.     fi
  16.  
  17.     for f
  18.     do
  19.         if [ "$(builtin type -type $f)" != "function" ] ; then
  20.             echo "func: $f: not a function" 1>&2
  21.             status=1    # one failed
  22.             continue
  23.         fi
  24.         builtin type $f | sed 1d
  25.     done
  26.     return $status
  27. }
  28.